﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace FusionDotNet
{
    internal class ExceptionBuilder
    {
        internal static TException BuildException<TException>(string message) where TException : Exception, new()
        {
            return (TException)typeof(TException).GetConstructor(new System.Type[] { typeof(string)}).Invoke(new object[] { message});
        }

        internal static Exception BuildException<TException>(string message, System.Exception innerException) where TException : Exception, new()
        {
            return (TException)typeof(TException).GetConstructor(new System.Type[] { typeof(string), typeof(Exception) }).Invoke(new object[] { message, innerException });        
        }
    }
}
